#ifndef FILE_se_AnimatedSprite_HPP
#define FILE_se_AnimatedSprite_HPP

#include "../System.hpp"
#include <SFML/Graphics.hpp>



namespace se{
namespace Graphics{
	
class DrawableDataPool;
class AnimationData;
class Drawable;

struct AnimatedSpritePOD: public sf::Transformable{
	AnimatedSpritePOD(AnimationData *d,Time_t t);
	AnimationData* animation;	
	Time_t currentTime;
	static void render(sf::RenderTarget& r,Drawable& d);
	static boost::function<void(sf::RenderTarget& r,Drawable& d)> renderFunction;
};

/********************************************//**
 * \brief An implementation of the Sprite, allowing animation.
 *
 * Is to be used with a DrawableDataPool, which will provide the
 * animations given a string.
 * \note For now, using the SetSubRect method will yield strange
 * results. Don't. But if we have time, it will be solved.
 ***********************************************/
class AnimatedSprite: public AnimatedSpritePOD{
	public :
	AnimatedSprite();
	AnimatedSprite(DrawableDataPool &pool);
	AnimatedSprite(const AnimatedSprite&);
	~AnimatedSprite();
	
	void SetAnim(const std::string& animName);
	
	void Update();
	
	Time_t GetInstanceTime() const;
	void SetTimeRef(System::Chrono& c);

	uint16_t Layer;
	protected :
	System::Chrono* m_timeRef;
	DrawableDataPool* m_dataPool;
	Time_t m_timeStarted;
	
	Time_t getTime();
};//</class AnimatedSprite>


}}//</namespace se::Graphics>


#endif
